'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
var simpleGet = exports.simpleGet = function simpleGet() {
    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
    }

    var obj = args[0],
        path = args[1],
        defVal = args[2];

    if (!path) {
        return obj[path];
    }
    if (typeof path === 'string') {
        path = path.split('.');
    }
    var rst = obj;
    for (var i = 0; i < path.length; i++) {
        rst = rst[path[i]];
        if (rst === null || rst === undefined) {
            return args.length > 2 ? defVal : rst;
        }
    }
    return rst;
};
exports.default = simpleGet;